import request from '@/router/request'
const baseUrl = "/api/sys/user"

// 获取用户信息
export function getUserInfo(name) {
  return request({
    url: baseUrl + '/info/' + name,
    method: 'get',
  })
}

export function getPage(params) {
  return request({
    url: baseUrl + "/page",
    method: 'get',
    params
  })
}

export function getList(params) {
  return request({
    url: baseUrl + "/list",
    method: 'get',
    params
  })
}

export function remove(id) {
  return request({
    url: baseUrl + '/' + id,
    method: 'delete',
  })
}

export function add(data) {
  return request({
    url: baseUrl,
    method: 'post',
    data
  })
}

export function edit(data) {
  return request({
    url: baseUrl,
    method: 'put',
    data
  })
}

const config = {
  headers: {
    "Content-Type": "multipart/form-data",
  },
};

// permit上传
export const uploadPermit = (data, params) => {
  return request({
    url: baseUrl + '/permit',
    method: 'post',
    data,
    params
  }, config)
}


export function logout(params) {
  return request({
    url: baseUrl + "/logout",
    method: 'get',
    params
  })
}
